﻿//-----------------------------------------------------------------------
// <copyright file="ConsoleProjectTests.cs" author="Artak Mkrtchyan">
//     Creative Commons - GNU General Public License (http://creativecommons.org/licenses/GPL/2.0/
// </copyright>
// <author>Artak Mkrtchyan</author>
// <email>mkArtak@gmail.com</email>
// <date>03/06/2013</date>
//-----------------------------------------------------------------------
using ConsoleHoster.Model.Entities;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace ConsoleHoster.UnitTests.ModelTests.EntitiesTests
{
	[TestClass]
	public class ConsoleProjectTests
	{
		[TestMethod]
		public void GetCopy_DoesWithoutCommands()
		{
			TestRepository tmpRepository = new TestRepository();

			ConsoleProject tmpCopy = tmpRepository.ConsoleProject1.GetCopy(false);

			Assert.AreEqual(tmpRepository.ConsoleProject1.Arguments, tmpCopy.Arguments);
			Assert.AreEqual(tmpRepository.ConsoleProject1.AutoLoad, tmpCopy.AutoLoad);
			Assert.AreEqual(tmpRepository.ConsoleProject1.BackgroundColor, tmpCopy.BackgroundColor);
			Assert.AreEqual(tmpRepository.ConsoleProject1.CaretColor, tmpCopy.CaretColor);
			Assert.IsNull(tmpCopy.Commands);
			Assert.AreEqual(tmpRepository.ConsoleProject1.ErrorMessageColor, tmpCopy.ErrorMessageColor);
			Assert.AreEqual(tmpRepository.ConsoleProject1.Executable, tmpCopy.Executable);
			Assert.AreEqual(tmpRepository.ConsoleProject1.IsEditable, tmpCopy.IsEditable);
			Assert.AreEqual(tmpRepository.ConsoleProject1.MessageColor, tmpCopy.MessageColor);
			Assert.AreEqual(tmpRepository.ConsoleProject1.Name, tmpCopy.Name);
			Assert.AreEqual(tmpRepository.ConsoleProject1.ProjectColor, tmpCopy.ProjectColor);
			Assert.AreEqual(tmpRepository.ConsoleProject1.ShowExplorerByDefault, tmpCopy.ShowExplorerByDefault);
			Assert.AreEqual(tmpRepository.ConsoleProject1.WorkingDir, tmpCopy.WorkingDir);
		}

		[TestMethod]
		public void GetCopy_DoesWithCommands()
		{
			TestRepository tmpRepository = new TestRepository();

			ConsoleProject tmpCopy = tmpRepository.ConsoleProject1.GetCopy(true);

			Assert.AreEqual(tmpRepository.ConsoleProject1.Arguments, tmpCopy.Arguments);
			Assert.AreEqual(tmpRepository.ConsoleProject1.AutoLoad, tmpCopy.AutoLoad);
			Assert.AreEqual(tmpRepository.ConsoleProject1.BackgroundColor, tmpCopy.BackgroundColor);
			Assert.AreEqual(tmpRepository.ConsoleProject1.CaretColor, tmpCopy.CaretColor);
			Assert.IsNotNull(tmpCopy.Commands);

			Assert.AreEqual(tmpRepository.ConsoleProject1.Commands.Count, tmpCopy.Commands.Count);

			Assert.AreEqual(tmpRepository.ConsoleProject1.ErrorMessageColor, tmpCopy.ErrorMessageColor);
			Assert.AreEqual(tmpRepository.ConsoleProject1.Executable, tmpCopy.Executable);
			Assert.AreEqual(tmpRepository.ConsoleProject1.IsEditable, tmpCopy.IsEditable);
			Assert.AreEqual(tmpRepository.ConsoleProject1.MessageColor, tmpCopy.MessageColor);
			Assert.AreEqual(tmpRepository.ConsoleProject1.Name, tmpCopy.Name);
			Assert.AreEqual(tmpRepository.ConsoleProject1.ProjectColor, tmpCopy.ProjectColor);
			Assert.AreEqual(tmpRepository.ConsoleProject1.ShowExplorerByDefault, tmpCopy.ShowExplorerByDefault);
			Assert.AreEqual(tmpRepository.ConsoleProject1.WorkingDir, tmpCopy.WorkingDir);
		}
	}
}
